
** estimate main effects while controlling for other pollutants 

***Inputs: 
* $Data/GameUserWPdaily_norm.dta
* $Data/GameUser_otherpoll_zd.dta
* $Data/maxmindirectionsmonth_zip260.dta

***Ouptus: 
* $Results/otherpollpm.tex

	use $Data/GameUserWPdaily_norm.dta, clear
	
	merge m:1 zip date using $Data/GameUser_otherpoll_zd.dta
	
	drop if _merge ==2
	drop _merge
	
	gen month = month(date)

	gen zip2 = int( zip/10)
	
	merge m:1 zip2 month using $Data/maxmindirectionsmonth_zip260.dta
	
	keep if _merge ==3
	drop _merge 
	
	
	gen monthyear = mofd(date)

	gen highpm =  weighted_dailypm > 25 & weighted_dailypm<. 

	
	egen cut_winddirection = cut(median_closestwind), at(0(60)360)
	replace cut_winddirection = 0 if median_closestwind ==360

	** highpm max wind IV 
	
	gen maxzipwind = (cut_winddirection ==maxdirection )
	replace maxzipwind = . if maxdirection==.
	
	keep if maxzipwind<. 	
	
	egen cut_temp = cut(weighted_temperature), at(-40(10)40)




ivreghdfe norm_score (highpm =maxzipwind ) weighted_dailyozone   weighted_wind_speed weighted_precipitation, absorb(anon_id monthyear cut_temp) cluster(anon_id monthyear)


eststo ozonepm


ivreghdfe norm_score (highpm =maxzipwind ) weighted_dailyco   weighted_wind_speed weighted_precipitation, absorb(anon_id monthyear cut_temp) cluster(anon_id monthyear)


eststo copm



ivreghdfe norm_score (highpm =maxzipwind ) weighted_dailyso2   weighted_wind_speed weighted_precipitation, absorb(anon_id monthyear cut_temp) cluster(anon_id monthyear)


eststo so2pm



ivreghdfe norm_score (highpm =maxzipwind ) weighted_dailyno2   weighted_wind_speed weighted_precipitation, absorb(anon_id monthyear cut_temp) cluster(anon_id monthyear)


eststo no2pm



ivreghdfe norm_score (highpm =maxzipwind ) weighted_dailyozone weighted_dailyco weighted_dailyso2 weighted_dailyno2   weighted_wind_speed weighted_precipitation, absorb(anon_id monthyear cut_temp) cluster(anon_id monthyear)


eststo allpm


label variable highpm "Daily PM2.5 $>$ 25" 
label variable weighted_dailypm "Daily PM2.5"
label variable weighted_dailyozone "Daily Ozone"
label variable weighted_dailyco "Daily CO"
label variable weighted_dailyso2 "Daily SO2"
label variable weighted_dailyno2 "Daily NO2"


esttab ozonepm copm so2pm no2pm allpm using $Results/otherpollpm.tex, drop(weighted_wind_speed weighted_precipitation) replace se scalars("widstat First stage F") nocon star(* 0.1 ** 0.05 *** 0.001) label nomtitles
	



	
	
	
	
	
